package com.example.l3.ktm;

import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;

import android.app.*;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;

import com.example.l3.ktm.DownloadUtility.*;

public class newdownload extends Activity {
	
	private Button btnDownload;
	
	//use for parse json
	JSONParser jsonParser;
	
	private final String TAG = "L3";
	private RadioButton radPrecache;
	private RadioButton radInput;
	
	// sample URL to download mp3 file. If error, try other Url and change other format file 
	//in initFileLoader function of DownloadManager activity
	private final String VIDEO_URL = "http://205.196.123.8/edm55z8p4owg/fug641brb09txhw/Oreilly+-+Programming+the+iPhone+User+Experience+%282009%29+%28ATTiCA%29.pdf"; 
	
	/*
	 When click button download, newdownload activity will send sample URL string to DownloadManager activity
	  */
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_new_download);
		
		btnDownload = (Button)findViewById(R.id.btnDownload);
		radPrecache=(RadioButton)findViewById(R.id.radPrecache);
		radInput=(RadioButton)findViewById(R.id.radInput);
		
		btnDownload.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intentResult = new Intent();
				
				intentResult.putExtra("url", getURLInput());
				setResult(2, intentResult);
				finish();
				
				
				// sample parse file json in assets folder of project
				
				
			}
		});
	}
	
	private String[] getURLInput()
	{
		String[] urls = {VIDEO_URL};
		return urls;
	}
}
